Hell who are they welcome to feed you on Javascript variables.
Variables are containers that you can use to store values in.
It's kind of like a little too eerie or memory holds value and that can be referenced later variable
must have a name.
And there are conditions in name in variables.
For example you can not begin a variable name with any number you can't for example name it variable
for cash.
You can however name it cash 24.
You can not use mathematical or logical operators in variable names.
For example you can name a variable 7 star or 7 question mark consort.
You can't use punctuation mark.
However you can use an underscore to name variable names but that's the only exception.
You can't use any other punch Nations.
Jeb us group names must not contain spaces so you can have a variable name called Cash 24.
And they can not be a space between the cash and the 24.
So the names must contain no spaces variable names are case sensitive variable.
The lower case X and upper case X are two different variables.
You can not use any javascript key words or any key word that is part of the javascript language.
You can't use that variable name for example you can't have a variable code alert something or prompt.
Those are part of the javascript key word.
The name on the variable itself is really up to us or to you.
So more is better.
The name you give is a variable represent the piece of data that you want to store.
For example if you are storing details about customer accounts you can name the variable customer count
so it makes it relevant or Shehan.
If you are storing details about an address you can name the variable cost to address a variable I created
using the key word var which is if you are in a lower case.
I will be creating a sample variable in a few minutes.
All right just before I create some variables.
I just want to go through what I have spoken about so far.
That variables are containers used to store values that can be referenced and used later.
Variable names are case sensitive so you name it variable.
Lower case X and try and change the value thinking it's an upper case X..
You may get some issues.
Variables are created or declared using the key word and here are.
You can not begin the variable names with no.
E.g. 247 carriage you can reverse it like cash two for seven dollars.
Group names must not have spaces between them.
If fast cars tell us groupy was cannot be used like learned some plant variable without value is known
as undefined.
Also why is you arguing the variable of value.
You can change it any time.
So let's go ahead and create some variables.
All right this is my sample script here.
This is my text said it all.
This is the page that this code here displays.
So got one content which is this one tack here.
Right so this is the javascript so what I need to focus on is the code between the script tag.
So I've created a few variables here.
The first one is a variable to chord X and it stores the value of 27.
Next one is a variable called Y is stores of value of 38.
And they've got the variables Z and values equal still x plus y have also gone at a variable called
my car when a variable name is set up like it's called.
Come all k so you be in with lower case and then the first letter is an upper case.
I've also gone at a variable first name variable here.
Hasn't got any value.
My car hasn't got any value but these ones got a value.
It's always good to declare your variables at the beginning of the script and also set a value.
If you know what your values are so if I remove this comment run this alert.
It should give me the value of x and y some say an alert.
The result of a z z.
Means.
Variable said.
So if I say that and run that it should show me my browser.
So click run in Firefox.
So the last 6 to 5 so do result of Z is 65 to Z.
It's a tool of x and y.
So next if I run let me comment this again.
If I run this piece of code here you see what it says go run.
It says on defying new reason it is undefined because I have not set a value for my car.
I've alerted my car.
Boy hasn't got a family.
That's why he's called on to find out what's your variable boys created.
You can't always change the values later.
So for example I've already declared a variable x.
I can change that value from 27 any time variable has already been declared or created.
Right so this I have now given the value I have now set a value for the variable.
My car remember when I created it.
I didn't create a set of value.
It's always good to set a value if you know what the value should be but sometimes you don't always
know.
So I've said it variable.
So the variable my car and have now come down here and giving it a value of reinke for that.
So now alert for this alert comment let my car it will come up.
Ring true.
So let me see that run that ring from above because I am now giving it value.
So variable can always be called twice.
It has been declared so calling a variable or you need to do is called a name like it Don here.
I've already declared the variable of my car so to call it does alert the message my car and then he
shows up in the pop up window.
Right so Im going to comment this out.
All right Im just going to alert this variable here called first name.
Also when you are calling your variables make sure you call them by their right name.
For example if you notice a variable name here is come or case that is first and then the other part
of its first letter is capital.
If I came here and call the first name without a capital N the computer program programming language
will not know what I'm talking about javascript would just throw up an error or say I don't know what
you mean.
Sorry.
So you must name them or call them what you name them.
For example here I've called variable X..
If I come here and call a variable or PI case X it will not know what I'm talking about because the
case is sensitive.
So if I run this now it will come on but on defined because of not giving it a value.
When I declared it or created it.
So click on run
comes up as defined so I can now go ahead later and then give it a value.
K I have now given this variable here.
The first new variable have now giving it a value of you.
So give is now.
Got to name value.
So if I run a left first name it should come up.
You do me so let me run that.
All right so come on we you demi no longer says on defined because Eve has now got a value.
Also once a variable has been declared or created you can always change the name.
All it is is a container label.
You can always change what you've got inside.
So what you store can always change.
So for example if I want to change this name from Demi to something else say to Jack has put Jack there.
So I changed that to Jack save that.
Run it.
It's now coming up with the value of Jack.
So I've changed.
What's in the container so you can always change the variable once it's being declared you can change
the value of the variable once it is been declared.
So be careful that variable names are case sensitive.
Okay I apologize.
This video has gone on a bit longer than I expected.
There was so much I wanted to cover.
I do apologize.
It's too long.
Thank you so much for watching.
I hope the video has made sense if it hasn't.
Please feel free to contact me and I you now have some kind of understanding of what variables are how
to create them.
Also thank you so much for watching.
Bye for now.